#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
int t;
long long n, ans, arr[20];
int main(){
	cin >> t;
	while(t--){
		memset(arr, 0, 20 * 8);
		int len = 0;
		ans = 0;
		cin >> n;
		for (long long i = 10; i < n; i *= 10){
			if (n % (i + 1) == 0){
				ans++;
				arr[len] = n / (i + 1);
				len++;
			}
		}
		sort(arr, arr + len);
		cout << ans << endl;
		for (int i = 0; i < len; i++){
			cout << arr[i] << " ";
		}
		if (len != 0) cout << endl;
	}
	return 0;
}
